package com.example;

import com.example.beans.Product;
import com.example.beans.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        
        Product product = (Product) context.getBean("product");
        Student student = (Student) context.getBean("student");
        
        System.out.println("========== Spring IOC 容器示例 ==========");
        System.out.println("获取到的 Product Bean: " + product);
        System.out.println("获取到的 Student Bean: " + student);
        System.out.println("========================================");

        ((ClassPathXmlApplicationContext) context).close();
    }
}